#include "..\..\LunarLib\include\L3DEngine.h"
#include <d3dx9.h>


class LD3D : public L3DEngine
{

public:
	LD3D();
	~LD3D();


	// Initializing
	int			Init3D(HWND	hWnd);
	int			Release3D();
	int			GetDeviceCount();
	int			GetCurrentDevice();
	
	// rendering related
	int			Clear(int r, int g, int b);
	int			Begin3D();
	int			End3D();


	// text related
	int			PaintText(char* txt, int x, int y);

	// camera related
	void		SetCamera();
	void		SetCamera(CAMERA&	c);


protected:

	HWND						m_hWnd;
	LPDIRECT3D9					m_lpd3d;
	LPDIRECT3DDEVICE9		m_lpd3ddevice;
	LPDIRECT3DSURFACE9		m_backbuffer;
	LPDIRECT3DTEXTURE9		m_tex0;
	LPDIRECT3DTEXTURE9		m_tex1;
	LPDIRECT3DTEXTURE9		m_tex2;
	LPDIRECT3DTEXTURE9		m_tex3;
	LPDIRECT3DTEXTURE9		m_tex4;
	LPD3DXFONT			    	m_font;

	D3DXMATRIX				matView;
	D3DXMATRIX				matProj;

	D3DCAPS9				d3dCaps;
	CAMERA					camera;
	FOV						fov;
	
	LRGB					TextColor;

	D3DADAPTER_IDENTIFIER9*	devInfo;
	int						DeviceCount;
	int						CurrentDevIndex;

	SCREENMODE				currentmode;
};